package com.hyt.it.ogt.kq.service.gov.schedule.model;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;

import cn.hutool.core.collection.CollUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Builder;
import lombok.NoArgsConstructor;

/***
 * 考场信息
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@EqualsAndHashCode(of = { "roomId" })
public class ExamRoom {

    @ApiModelProperty(value = "批次考场ID")
    public String roomTimeId;

    @ApiModelProperty(value = "考场ID")
    public String placeId;

    @ApiModelProperty(value = "考场ID")
    public String roomId;

    @ApiModelProperty(value = "考场考试科目")
    public Set<String> subjects;

    @ApiModelProperty(value = "考场应答方式")
    public String examType;

    @ApiModelProperty(value = "省份")
    public String province;

    @ApiModelProperty(value = "城市")
    public String city;

    @ApiModelProperty(value = "区县")
    public String district;

    @ApiModelProperty(value = "所属一级机构")
    public String level;

    @ApiModelProperty(value = "所属二级机构")
    public String levelTwo;

    @ApiModelProperty(value = "所属三级机构")
    public String levelThree;

    @ApiModelProperty(value = "所属四级机构")
    public String levelFour;

    @ApiModelProperty(value = "考场容量: 考场坐位数或机位数")
    public int capacity;

    @ApiModelProperty(value = "考区：暂时不考虑，保留")
    public int examArea;

    @ApiModelProperty(value = "考场空闲座位，在编排的时进行设值")
    public final LinkedList<Integer> idlePosition = new LinkedList<>();

    @ApiModelProperty(value = "虚拟考场分组名, 虚拟考场编排用")
    public String virGroupName;

    @ApiModelProperty(value = "考场科目约束, 主要用于单科目编排时对考场的限制")
    public String constraintSubject;

    @ApiModelProperty(value = "考场虚拟考生ID")
    public String virCandidateId;

    @ApiModelProperty(value = "考场虚拟考生占用考试科目列表")
    public final List<String> batchSubjectList = new ArrayList<>();

    public void mergeBatchSubjectList(List<String> mergeSubjectList) {
        if (CollUtil.isEmpty(batchSubjectList)) {
            this.batchSubjectList.addAll(mergeSubjectList);
        } else {
            for (int index = 0; index < this.batchSubjectList.size(); index++) {
                if (this.batchSubjectList.get(index).equalsIgnoreCase("ANY")) {
                    this.batchSubjectList.set(index, mergeSubjectList.get(index));
                }
            }
        }

    }

}
